<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"></script>
    <style>
        .active0 {
            background: red;
        }

        .active1 {
            background: blue;
        }

        .active2 {
            background: yellow;
        }
    </style>
</head>

<body>

    <div id="app">
        <div v-for="(v, i) in arr">
            <button :class="[select === i ? 'active' + i : '']" @click="add(i)">{{ arr[i].key }}</button>
        </div>
    </div>

    <script>
        new Vue({
            el: '#app',
            data: {
                select: null,
                arr: [
                    { id: 0, key: '第一个' },
                    { id: 0, key: '第二个' },
                    { id: 0, key: '第三个' }
                ]
            },
            methods: {
                add(i) {
                    this.arr[i].id = i;
                    this.select = i;
                }
            }
        })
    </script>
</body>

</html>